Skip to content

chore(spec): every skill-examples surface build dir is gitignored (and asserted) - #11555

Merged
os-steve merged 2 commits into
mainfrom
claude/issue-11440-examples-build-gitignore
Aug 24, 2026
Merged

os-steve merged 2 commits into
mainfrom
claude/issue-11440-examples-build-gitignore

Conversation

@os-steve

Copy link
Copy Markdown
Collaborator

Fixes #11440

check:skill-examples writes each surface's extracted blocks to a throwaway build dir under that surface's resolutionDir, wiping and deleting it on every run — so a gap in .gitignore is invisible on a clean pass and only surfaces via --keep (a documented debug flag) or a run interrupted before cleanup, at which point a routine git add -A commits the extracted blocks into someone's PR.

Per-surface coverage

Surface resolutionDir build dir .gitignore before after
skills + docs (@objectstack/spec) packages/spec .examples-build covered covered
spec source TSDoc (@objectstack/spec, #11433) packages/spec .examples-build-src covered covered
client SDK (@objectstack/client-react, @objectstack/client, #10969) packages/client-react .examples-build not covered covered

One line added beside the existing pair, and the comment above generalised to "one per surface" (already generalised by #11433; unchanged here).

Assert: assertGitignoredBuildDirs()

A sibling of #11433's assertDistinctBuildDirs(), in the same file, wired into main() right after it. It walks SURFACES, and for each declared build dir runs git check-ignore -q (via a small isGitIgnored() helper) asserting the dir is covered — fail()s with the surface name and the exact .gitignore line to add if not.

One mechanical wrinkle worth noting: git check-ignore only matches a directory-only pattern (every entry here ends in /) against a path it can tell IS a directory — either because the path exists on disk, or because the query itself carries a trailing separator. Since this gate deletes the build dir on exit, the directory is normally absent, so isGitIgnored() always queries with a trailing path.sep appended.

--self-test adds a fixture (sibling to the build-dir-distinctness one) that inits a throwaway git repo, gives it a .gitignore covering one stub surface's build dir but not another's, and asserts isGitIgnored() / findUnignoredBuildDir() catch the gap in both directions — plus a check that the REAL SURFACES are fully covered (this is what pre-fix reverse verification failed).

Caught by the real test suite: a non-git sandbox false-positive

dist-freshness-adoption.test.ts runs this same script against a "repo-shaped" temp tree that is deliberately not a real git checkout (its own header explains why — making the real packages/spec/dist stale to drive a refusal would corrupt whatever else is running in the container). git check-ignore there exits 128 ("fatal: not a git repository"), and a first version of isGitIgnored() read any non-zero status as "not ignored" — which made the new assert fire first in every one of that file's cases, ahead of the dist-freshness refusal they exist to probe (3 failing tests, caught by pnpm --filter @objectstack/spec test, not by --self-test, whose own throwaway repo IS a real git init). Fixed by having isGitIgnored() return boolean | null (null = indeterminate, not a git working tree) and having findUnignoredBuildDir() treat only an authoritative false as a gap. Pinned with a new non-git self-test fixture; re-confirmed against the real suite: vitest run scripts/dist-freshness-adoption.test.ts — 10 passed (10).

Reverse verification

At the committed fix, temporarily reverted just the new .gitignore line and re-ran:

$ pnpm --filter @objectstack/spec exec tsx scripts/check-skill-examples.ts

✗ Surface "client SDK (@objectstack/client-react, @objectstack/client)"'s build dir packages/client-react/.examples-build is not covered by .gitignore.

  This gate deletes the dir on a clean run, so the gap is invisible until `--keep`
  or an interrupted run leaves it behind — at which point a routine `git add -A`
  commits the extracted blocks into someone's PR. Add `packages/client-react/.examples-build/` to .gitignore.

Exit 1, naming exactly the surface the issue describes. Restored via git checkout HEAD -- .gitignore (the fix was already committed) and re-ran green.

Verification

All at final commit 6b5de1105c, tree clean vs HEAD:

  • git check-ignore -q packages/client-react/.examples-build/ — red pre-fix (measured on origin/main at merge base), green post-fix; both spec surfaces stay green throughout.
  • pnpm --filter @objectstack/spec exec tsx scripts/check-skill-examples.ts --self-test — green, including the new gitignore + non-git fixtures.
  • pnpm --filter @objectstack/spec check:skill-examples (self-test + real gate) — green: 253 marked example(s) across 97 file(s), 3 surface(s).
  • pnpm --filter @objectstack/spec test — green: 420 Test Files passed (420), 11204 Tests passed (11204).
  • pnpm --filter @objectstack/spec typecheck (tsc --noEmit + check:scripts-typecheck + check:test-typecheck) — green.
  • node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack — derived 13 local gate families for this diff, all run and green: check:empty-state, check:liveness, check:merge-driver, check:published-files, check:slot-lookup, check:strictness-ledger, check:test-source-alias, check:type-source-resolution, check:variant-docs, check-ci-filter-parity.mjs, check-dev-prereqs.mjs --self-test (its only CI-invoked form), check-plugin-teardown-shape.mjs, docs-audit/check-affected-docs.mjs.

Scope

Diff is .gitignore + packages/spec/scripts/check-skill-examples.ts only — no packages/spec/src/** touched (clause-② out of scope for this card). packages/spec/scripts/ is not in the package's published files — this ships no consumer-visible bytes, so skip-changeset rather than a changeset.


Generated by Claude Code

claude added 2 commits August 24, 2026 02:47
git check-ignore exits 128 (not 0/1) when cwd has no .git ancestor, which
dist-freshness-adoption.test.ts's sandboxed tree deliberately is not. Reading
128 as 'not ignored' made the new assert fire before the freshness refusals
those tests probe. isGitIgnored now returns boolean | null; only an
authoritative false counts as a gap.
@claude claude Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Aug 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs.

@github-actions github-actions Bot added the tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface label Aug 24, 2026
@os-steve
os-steve marked this pull request as ready for review August 24, 2026 03:21
@os-steve
os-steve added this pull request to the merge queue Aug 24, 2026
Merged via the queue into main with commit 7bdb156 Aug 24, 2026
35 checks passed
@os-steve
os-steve deleted the claude/issue-11440-examples-build-gitignore branch August 24, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m skip-changeset PR has no user-facing published change; bypasses the changeset gate tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[finding] packages/client-react/.examples-build/ is not gitignored — check:skill-examples' second surface writes an untracked throwaway dir

2 participants